package com.yance.fim.core.enums;

/**
 * @author yance
 */

public enum ErrorCode {

    //服务发送错误
    ERROR_CODE_SERVER_ERROR(400, "server error");

    public int code;
    public String msg;

    ErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ErrorCode fromCode(int code) {
        for (ErrorCode errorCode : values()) {
            if (errorCode.code == (code & 0xff)) {
                return errorCode;
            }
        }
        return ERROR_CODE_SERVER_ERROR;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
